﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProDivingAdmin2salmon14
{
    public class DisplayDive
    {
        public int orderNumber { get; set; }
        public string diverName { get; set; }
        public string diverNationality { get; set; }
        public string diveCode { get; set; }
        public string diveHeight { get; set; }
        public float diveDificulty { get; set; }
        public string diveName { get; set; }

        public DisplayDive(int orderNumber, string diverName, string diverNationality, string diveCode, string diveHeight, float diveDificulty, string diveName) 
        {
            this.orderNumber = orderNumber;
            this.diverName = diverName;
            this.diverNationality = diverNationality;
            this.diveCode = SetDiveCode(diveCode);
            this.diveHeight = diveHeight;
            this.diveDificulty = diveDificulty;
            this.diveName = diveName;
        }

        private string SetDiveCode(string diveCode) 
        {
            for (int i = 0; i < diveCode.Length; i++) 
            {
                if (char.IsLetter(diveCode[i])) 
                {
                    return diveCode.Remove(i + 1);
                }
            }
            return "";
        }
    }
}
